local xiongying = fk.CreateSkill({
    name = "sj6__xiongying",
    tags = {Skill.Compulsory},
})

Fk:loadTranslationTable{
  ["sj6__xiongying"] = "凶盈",
  [":sj6__xiongying"] = "<b>锁定技</b>，当你于回合内/回合外回复体力后，直到你下回合结束，其他角色于其回合内/回合外使用的【桃】无效。",
  
  ["@sj6__xiongying"] = "凶盈",
  ["#sj6__xiongying_1"] = "内",
  ["#sj6__xiongying_2"] = "外",
  
  ["$sj6__xiongying1"] = "不顺我意者，当填在野之壑。",
  ["$sj6__xiongying2"] = "吾令不从者，当膏霜锋之锷。",
}

xiongying:addEffect(fk.HpRecover, {
    can_trigger = function(self, event, target ,player, data)
      return player:hasSkill(xiongying.name) and target == player
    end,
    on_use = function(self, event, target, player, data)
      local room = player.room
      room:setPlayerMark(player,"#sj6__xiongying_"..(player.phase == Player.NotActive and 2 or 1),1)
      if player.phase ~= Player.NotActive then
        room:setPlayerMark(player,"sj6__xiongying-turn",1)
      end
      local m = "回合"
      for i = 1, 2, 1 do
        if player:getMark("#sj6__xiongying_"..i) > 0 then
          m = m..Fk:translate("#sj6__xiongying_"..i)
        end
      end
      room:setPlayerMark(player,"@sj6__xiongying",m)
    end,
})

xiongying:addEffect(fk.TurnEnd, {
  can_refresh = function(self, event, target ,player, data)
    return player:hasSkill(xiongying.name) and target == player
  end,
  on_refresh = function(self, event, target, player, data)
    local room = player.room
    room:setPlayerMark(player,"#sj6__xiongying_2",0)
    if player:getMark("sj6__xiongying-turn") == 0 then
      room:setPlayerMark(player,"#sj6__xiongying_1",0)
      room:setPlayerMark(player,"@sj6__xiongying",0)
    else
      room:setPlayerMark(player,"@sj6__xiongying","回合内")
    end
  end,
})

xiongying:addEffect(fk.CardUsing, {
  is_delay_effect = true,
  can_trigger = function(self, event, target ,player, data)
    return player:hasSkill(xiongying.name) and target ~= player and data.card.name == "peach" and
    (
      (player:getMark("#sj6__xiongying_1") > 0 and target.phase ~= Player.NotActive) or
      (player:getMark("#sj6__xiongying_2") > 0 and target.phase == Player.NotActive)
    )
  end,
  on_use = function(self, event, target, player, data)
    data.toCard = nil--令牌失效
    data.tos = {}
  end,
})

return xiongying